Create a new Function with the given name, description, and configuration. The response includes a URL (uploadPutUrl) for uploading the function’s code package. After uploading, call POST /functions/{name}/deploy to make the function runnable.
Rate limit: 100 requests/min (learn more about rate limits here).
To use this endpoint, select Write Functions under the Functions category when creating or editing an API token. Learn More.
Submit Feedback: Likes, dislikes, and API feature requests should be filed as feedback in our API feedback form. If you encountered an issue or noticed inaccuracies in the API documentation, please submit a case to our support team.
curl --request POST \
--url https://api.samsara.com/functions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"config": {
"handler": "index.handler",
"isScheduleEnabled": false,
"params": {
"region": "us-west",
"threshold": "100"
},
"secrets": {
"API_KEY": "my-secret-value"
}
},
"name": "my-function",
"description": "Processes incoming telemetry data."
}
'{
"data": {
"codePackage": {
"status": "deployed",
"downloadGetUrl": "https://example.com/download?token=..."
},
"config": {
"handler": "index.handler",
"isScheduleEnabled": false,
"params": {
"Architecto sed delectus alias molestiae iure.": "Ut dolorem.",
"Doloribus maiores et inventore neque nemo voluptatem.": "Nemo et delectus ab est."
},
"secrets": {
"Qui aut voluptas.": "Et quia corrupti deserunt molestiae est."
},
"schedule": {
"entries": [
{
"daysOfWeek": [
false,
true,
true,
true,
true,
true,
false
],
"timeSinceMidnightMs": 32400000
}
],
"timezone": "America/Los_Angeles"
}
},
"createdAtTime": "2021-01-01T00:00:00Z",
"effects": {
"nextScheduledAtTime": "2021-01-01T00:00:00Z"
},
"lastUpdateTimestampMs": 1609459200000,
"name": "my-function",
"updatedAtTime": "2021-01-01T00:00:00Z",
"uploadPutUrl": "https://example.com/upload?token=...",
"description": "Processes incoming telemetry data."
}
}Documentation Index
Fetch the complete documentation index at: https://samsara-showcase.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
OK response.
Details of a newly created Function, including a URL for uploading the code package. After uploading, call the deploy endpoint to make the function runnable.
Show child attributes
curl --request POST \
--url https://api.samsara.com/functions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"config": {
"handler": "index.handler",
"isScheduleEnabled": false,
"params": {
"region": "us-west",
"threshold": "100"
},
"secrets": {
"API_KEY": "my-secret-value"
}
},
"name": "my-function",
"description": "Processes incoming telemetry data."
}
'{
"data": {
"codePackage": {
"status": "deployed",
"downloadGetUrl": "https://example.com/download?token=..."
},
"config": {
"handler": "index.handler",
"isScheduleEnabled": false,
"params": {
"Architecto sed delectus alias molestiae iure.": "Ut dolorem.",
"Doloribus maiores et inventore neque nemo voluptatem.": "Nemo et delectus ab est."
},
"secrets": {
"Qui aut voluptas.": "Et quia corrupti deserunt molestiae est."
},
"schedule": {
"entries": [
{
"daysOfWeek": [
false,
true,
true,
true,
true,
true,
false
],
"timeSinceMidnightMs": 32400000
}
],
"timezone": "America/Los_Angeles"
}
},
"createdAtTime": "2021-01-01T00:00:00Z",
"effects": {
"nextScheduledAtTime": "2021-01-01T00:00:00Z"
},
"lastUpdateTimestampMs": 1609459200000,
"name": "my-function",
"updatedAtTime": "2021-01-01T00:00:00Z",
"uploadPutUrl": "https://example.com/upload?token=...",
"description": "Processes incoming telemetry data."
}
}